home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Core / ToknTabl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  2.8 KB  |  104 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ToknTabl.h
  3.  
  4.     Contains:    The TokenTable class.
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    © 1993 - 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <4>     8/19/94    NP        1181622: Ownership fix.
  13.          <3>     7/29/94    CG        NameSpace API changes.
  14.          <2>     6/27/94    CG        Removed fEv - not thread safe.
  15.          <1>      6/7/94    CG        first checked in
  16.          <3>    11/15/93    NP        Changed ODSymbols to ODNameSpaceManager.
  17.          <2>    10/28/93    NP        GetType returns a boolean instead of
  18.                                     throwing an exception.
  19.          <1>    10/25/93    NP        first checked in
  20.          <4>      8/9/93    NP        Added class id string.
  21.          <3>     7/21/93    NP        Added a virtual keyword (temporary for
  22.                                     ASLM).
  23.          <2>     6/23/93    RCR        Moved ODTypeToken to ODTypes.h
  24.          <1>     6/22/93    NP        first checked in
  25.  
  26.     To Do:
  27. */
  28.  
  29. #ifndef _ODTOKNTABL_
  30. #define _ODTOKNTABL_
  31.  
  32. #ifndef _PLFMDEF_
  33. #include "PlfmDef.h"
  34. #endif
  35.  
  36. #ifndef _ODTYPES_
  37. #include "ODTypes.h"
  38. #endif
  39.  
  40. //==============================================================================
  41. // Theory of Operation
  42. //==============================================================================
  43.  
  44. /*
  45.     This class keeps a table of ODTypes and their corresponding unique tokens.
  46. */
  47.  
  48. //==============================================================================
  49. // Scalar Types
  50. //==============================================================================
  51.  
  52.  
  53. //==============================================================================
  54. // Classes defined in this interface
  55. //==============================================================================
  56.  
  57. class TokenTable;
  58.  
  59. //==============================================================================
  60. // Classes used by this interface
  61. //==============================================================================
  62.  
  63. class ODValueNameSpace;
  64. class ODNameSpaceManager;
  65.  
  66. //==============================================================================
  67. // ODClass
  68. //==============================================================================
  69.  
  70. #define kODTokenTableID "appl:TokenTable$class,1.0.0"
  71.  
  72. class TokenTable
  73. {
  74.   public:
  75.  
  76.     TokenTable(ODNameSpaceManager* mgr);
  77.     ODVMethod void Initialize();
  78.     virtual ~TokenTable();
  79.  
  80.     ODVMethod ODTypeToken    Tokenize(ODType type);
  81.         
  82.         // Returns a unique token for type. If the type was previously
  83.         //    tokenized, the original token is returned. Throws kODErrOutOfMemory
  84.         //    if tokenization fails.
  85.     
  86.     ODVMethod void            RemoveEntry(ODType type);
  87.         
  88.         // Removes type from the table. If type was not
  89.         //    previously tokenized, no error is signalled.
  90.     
  91.     ODVMethod ODBoolean    GetType(ODTypeToken token, ODType* type);
  92.         
  93.         // Returns type, given token. If token does not exist in the table,
  94.         //    kODFalse is returned. Otherwise, kODTrue is returned.
  95.     
  96.   protected:
  97.  
  98.     ODNameSpaceManager*    fNameSpaceManager;
  99.     ODValueNameSpace*    fNameSpace;
  100.     ODULong                fNextUniqueID;
  101. };
  102.  
  103.  
  104. #endif // _ODTOKNTABL_